﻿using Mohe.Scada.Util.Models;

namespace Mohe.Scada.Util.TimeSeries
{
    /// <summary>
    /// 保存数据
    /// </summary>
    public interface IStorage
    {
        /// <summary>
        /// 保存遥测数据
        /// </summary>
        /// <param name="temperatureData"></param>
        /// <returns></returns>
        Task<bool> StoreTelemetryAsync(PayLoad telemetryData);
        /// <summary>
        /// 加载遥测数据
        /// </summary>
        /// <param name="deviceId"></param>
        /// <param name="keys"></param>
        /// <param name="begin"></param>
        /// <param name="end"></param>
        /// <param name="every"></param>
        /// <param name="aggregate"></param>
        /// <returns></returns>
        Task<List<TelemetryData>> LoadTelemetryAsync(string keys, DateTime begin, DateTime end, TimeSpan every, EnumAggregate aggregate);

        #region 温度报告
        /// <summary>
        /// 保存温度
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        Task<bool> StoreTemperatureAsync(List<TemperatureData> data);
        /// <summary>
        /// 加载温度
        /// </summary>
        /// <param name="StationNo"></param>
        /// <param name="SerialNum"></param>
        /// <param name="pageSize"></param>
        /// <param name="pageIndex"></param>
        /// <returns></returns>
        Task<List<TemperatureData>> LoadTemperatureAsync(int StationNo, int SerialNum = 0, int pageSize = 1000, int pageIndex = 1);
        /// <summary>
        /// 加载温度
        /// </summary>
        /// <param name="beginTime"></param>
        /// <param name="endTime"></param>
        /// <param name="StationNo"></param>
        /// <param name="pageSize"></param>
        /// <param name="pageIndex"></param>
        /// <returns></returns>
        Task<List<TemperatureData>> LoadTemperatureAsync(string beginTime, string endTime, int StationNo, int pageSize = 1000, int pageIndex = 1);
        #endregion

        #region 整流报告
        /// <summary>
        /// 保存整流
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        Task<bool> StoreMunkReportAsync(List<MunkReportData> data);
        /// <summary>
        /// 加载整流
        /// </summary>
        /// <param name="StationNo"></param>
        /// <param name="SerialNum"></param>
        /// <returns></returns>
        Task<List<MunkReportData>> LoadMunkReportData(int StationNo, int SerialNum);
        #endregion
    }
}
